<div class="main-wrap" id="person-center">
	<div class="wrap-left">
		<div class="wrap-list">
			<div class="m-user">
				<!--个人信息 -->

				<div class="m-userinfo">
					<a href="news.html">
						<div class="tipsBox"><i class="am-icon-envelope"></i></div>
					</a>
					<div class="m-baseinfo">
						<a class="m-pic" href="information.html">
							<img src="../images/getAvatar.do.jpg">
						</a>
						<div class="m-info">
							<em class="s-name">小叮当</em>
							<div class="vip1">
								<a href="#"><span></span><em>会员专享</em></a>
							</div>
							<div class="safeText">
								<a url="safety.html">账户安全:<em style="margin-left:20px ;" id="securityScore">60</em>分</a>
								<div class="progressBar">100<span style="left: -95px;" class="progress">100</span></div>
							</div>
							<div class="m-address">
								<a url="address.html" class="i-trigger">收货地址<i class="am-icon-angle-right" style="padding-left:5px ;"></i></a>
							</div>
						</div>
					</div>
					<div class="m-right">
						<div class="m-new">
							<a name="news.html"><i class="am-icon-dropbox  am-icon-md" style="padding-right:5px ;"></i>消息盒子</a>
						</div>

					</div>
				</div>

				<!--个人资产-->
				<div class="m-userproperty">
					<div class="s-bar">
						<i class="s-icon"></i>个人资产
					</div>
					<p class="m-wallet">
						<a href="wallet.html">
							<em class="m-num" id="balance">10000</em>
							<span class="m-title">账户余额</span>
						</a>
					</p>
					<p class="m-bill">
						<a href="pointnew.html">
							<em class="m-num" id="points">10</em>
							<span class="m-title">总积分</span>
						</a>
					</p>
				</div>

				<!--我的钱包-->
				<div class="wallet">
					<div class="s-bar">
						<i class="s-icon"></i>商城钱包
					</div>
					<p class="m-big squareS" id="shopable">
						<a href="#">
							<i><img src="../images/shopping.png"/></i>
							<span class="m-title">能购物</span>
						</a>
					</p>
					<p class="m-big squareA" id="securityable">
						<a href="#">
							<i><img src="../images/safe.png"/></i>
							<span class="m-title">够安全</span>
						</a>
					</p>
					<p class="m-big squareL" id="actively">
						<a href="#">
							<i><img src="../images/profit.png"/></i>
							<span class="m-title">很活跃</span>
						</a>
					</p>
				</div>

			</div>
			<div class="box-container-bottom"></div>

			<!--订单 -->
			<div class="m-order">
				<div class="s-bar">
					<i class="s-icon"></i>我的订单
					<a class="i-load-more-item-shadow" name="order.html">全部订单</a>
				</div>
				<ul>
					<li>
						<a href="order.html"><i><img src="../images/pay.png"/></i><span>待付款</span></a>
					</li>
					<li>
						<a href="order.html"><i><img src="../images/send.png"/></i><span>待发货<em class="m-num">1</em></span></a>
					</li>
					<li>
						<a href="order.html"><i><img src="../images/receive.png"/></i><span>待收货</span></a>
					</li>
					<li>
						<a href="order.html"><i><img src="../images/comment.png"/></i><span>待评价<em class="m-num">3</em></span></a>
					</li>
					<li>
						<a href="change.html"><i><img src="../images/refund.png"/></i><span>退换货</span></a>
					</li>
				</ul>
				<div id="orderList">
					<div class="orderContentBox">
						<div class="orderContent">
							<div class="orderContentpic">
								<div class="imgBox">
									<a href="orderinfo.html"><img src="../images/youzi.jpg"></a>
								</div>
							</div>
							<div class="detailContent">
								<a href="orderinfo.html" class="delivery">签收</a>
								<div class="orderID">
									<span class="time">2016-03-09</span>
									<span class="splitBorder">|</span>
									<span class="time">21:52:47</span>
								</div>
								<div class="orderID">
									<span class="num">共1件商品</span>
								</div>
							</div>
							<div class="state">待评价</div>
							<div class="price"><span class="sym">¥</span>23.<span class="sym">80</span></div>

						</div>
						<a href="javascript:void(0);" class="btnPay">再次购买</a>
					</div>

					<div class="orderContentBox">
						<div class="orderContent">
							<div class="orderContentpic">
								<div class="imgBox">
									<a href="orderinfo.html"><img src="../images/heart.jpg"></a>
								</div>
							</div>
							<div class="detailContent">
								<a href="orderinfo.html" class="delivery">派件</a>
								<div class="orderID">
									<span class="time">2016-03-09</span>
									<span class="splitBorder">|</span>
									<span class="time">21:52:47</span>
								</div>
								<div class="orderID">
									<span class="num">共2件商品</span>
								</div>
							</div>
							<div class="state">已发货</div>
							<div class="price"><span class="sym">¥</span>246.<span class="sym">50</span></div>

						</div>
						<a href="javascript:void(0);" class="btnPay">再次购买</a>
					</div>
				</div>
			</div>
			<!--九宫格-->
			<div class="user-squaredIcon">
				<div class="s-bar">
					<i class="s-icon"></i>我的常用
				</div>
				<ul>
					<a href="order.html">
						<li class="am-u-sm-4"><i class="am-icon-truck am-icon-md"></i>
							<p>物流查询</p>
						</li>
					</a>
					<a href="collection.html">
						<li class="am-u-sm-4"><i class="am-icon-heart am-icon-md"></i>
							<p>我的收藏</p>
						</li>
					</a>
					<a href="foot.html">
						<li class="am-u-sm-4"><i class="am-icon-paw am-icon-md"></i>
							<p>我的足迹</p>
						</li>
					</a>
					<a href="#">
						<li class="am-u-sm-4"><i class="am-icon-gift am-icon-md"></i>
							<p>为你推荐</p>
						</li>
					</a>
					<a href="blog.html">
						<li class="am-u-sm-4"><i class="am-icon-share-alt am-icon-md"></i>
							<p>我的分享</p>
						</li>
					</a>
					<a href="../home/home2.html">
						<li class="am-u-sm-4"><i class="am-icon-clock-o am-icon-md"></i>
							<p>限时活动</p>
						</li>
					</a>

				</ul>
			</div>

			<div class="user-suggestion">
				<div class="s-bar">
					<i class="s-icon"></i>会员中心
				</div>
				<div class="s-bar">
					<a href="suggest.html"><i class="s-icon"></i>意见反馈</a>
				</div>
			</div>
		</div>
	</div>
	<div class="wrap-right">

		<!-- 日历-->
		<div class="day-list">
			<div class="s-title">
				每日新鲜事
			</div>
			<div class="s-box">
				<ul>
					<li>
						<a>
							<p>粮油冲锋周 满128减18</p>
						</a>
					</li>
					<li>
						<a>
							<p>防晒这么重要的事怎能随意</p>
						</a>
					</li>
					<li>
						<a>
							<p>春日护肤面膜不可少，你选对了吗？</p>
						</a>
					</li>
					<li>
						<a>
							<p>纯粹时尚，摩登出游，吸睛美衣</p>
						</a>
					</li>
					<li>
						<a>
							<p>粮油冲锋周 满128减18</p>
						</a>
					</li>
					<li>
						<a>
							<p>春日护肤面膜不可少，你选对了吗？</p>
						</a>
					</li>
				</ul>
			</div>
		</div>
		<!--新品 -->
		<div class="new-goods">
			<div class="s-bar">
				<i class="s-icon"></i>今日新品
				<a class="i-load-more-item-shadow">15款新品</a>
			</div>
			<div class="new-goods-info">
				<a class="shop-info" href="#">
					<div class="face-img-panel">
						<img src="../images/imgsearch1.jpg" alt="">
					</div>
					<span class="new-goods-num ">4</span>
					<span class="shop-title">剥壳松子</span>
				</a>
				<a class="follow">收藏</a>
			</div>
		</div>

		<!--热卖推荐 -->
		<div class="new-goods">
			<div class="s-bar">
				<i class="s-icon"></i>热卖推荐
			</div>
			<div class="new-goods-info">
				<a class="shop-info" href="#" target="_blank">
					<div>
						<img src="../images/666.jpg" alt="">
					</div>
					<span class="one-hot-goods">￥189.60</span>
				</a>
			</div>
		</div>
	</div>
	<div class="clear"></div>

	<!--收藏和足迹-->
	<div data-am-widget="tabs" class="am-tabs collection">
		<ul class="am-tabs-nav am-cf">
			<li class="am-active">
				<a href="[data-tab-panel-0]"><i class="am-icon-heart"></i>商品收藏</a>
			</li>
			<li class="">
				<a href="[data-tab-panel-1]"><i class="am-icon-paw"></i>购物足迹</a>
			</li>
		</ul>
		<div class="am-tabs-bd">

			<div data-tab-panel-0 class="am-tab-panel am-active">
				<div class="am-slider am-slider-default am-slider-carousel" data-am-flexslider="{itemWidth:155,slideshow: false}">
					<ul class="am-slides" id="shopCollection">
						<li>
							<a><img class="am-thumbnail" src="../images/EZA27501.jpg" /></a>
							<strong class="price">¥32.9</strong>
						</li>
						<li>
							<a><img class="am-thumbnail" src="../images/BxJk6.jpg" /></a>
							<strong class="price">¥32.9</strong>
						</li>
						<li>
							<a><img class="am-thumbnail" src="../images/Hxcag60.jpg" /></a>
							<strong class="price">¥32.9</strong>
						</li>
						<li>
							<a><img class="am-thumbnail" src="../images/youzi.jpg" /></a>
							<strong class="price">¥32.9</strong>
						</li>
						<li>
							<a><img class="am-thumbnail" src="../images/EZA27501.jpg" /></a>
							<strong class="price">¥32.9</strong>
						</li>
						<li>
							<a><img class="am-thumbnail" src="../images/BxJk6.jpg" /></a>
							<strong class="price">¥32.9</strong>
						</li>
						<li>
							<a><img class="am-thumbnail" src="../images/Hxcag60.jpg" /></a>
							<strong class="price">¥32.9</strong>
						</li>
						<li>
							<a><img class="am-thumbnail" src="../images/youzi.jpg" /></a>
							<strong class="price">¥32.9</strong>
						</li>

					</ul>
				</div>
			</div>
			<div data-tab-panel-1 class="am-tab-panel ">
				<div class="am-slider am-slider-default am-slider-carousel" data-am-flexslider="{itemWidth:155, slideshow: false}">
					<ul class="am-slides" id="footPrint">
						<li>
							<a><img class="am-thumbnail" src="../images/BxJk6.jpg" /></a>
							<strong class="price">¥32.9</strong>
						</li>
						<li>
							<a><img class="am-thumbnail" src="../images/Hxcag60.jpg" /></a>
							<strong class="price">¥32.9</strong>
						</li>
						<li>
							<a><img class="am-thumbnail" src="../images/youzi.jpg" /></a>
							<strong class="price">¥32.9</strong>
						</li>
						<li>
							<a><img class="am-thumbnail" src="../images/EZA27501.jpg" /></a>
							<strong class="price">¥32.9</strong>
						</li>
						<li>
							<a><img class="am-thumbnail" src="../images/BxJk6.jpg" /></a>
							<strong class="price">¥32.9</strong>
						</li>
						<li>
							<a><img class="am-thumbnail" src="../images/Hxcag60.jpg" /></a>
							<strong class="price">¥32.9</strong>
						</li>
						<li>
							<a><img class="am-thumbnail" src="../images/youzi.jpg" /></a>
							<strong class="price">¥32.9</strong>
						</li>
						<li>
							<a><img class="am-thumbnail" src="../images/EZA27501.jpg" /></a>
							<strong class="price">¥32.9</strong>
						</li>
					</ul>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
	$("a[url]").click(function() {
		var url = $(this).attr("url");
		$("#col-main").load(url);
	});
	//需要到用户信息的地方该做的事情	
	var peple = window.person;
	//需要用到的用户积分
	var points = window.points;
	$(".s-name").text(peple.username) //添加用户名
	if(peple.email == null || peple.id_card == null || peple.mobile == "") { //判断用户信息是否安全
		$("#securityable").css("display", "none")
	}
	if(peple.balance == null) { //判断用户信息是否能购物
		$("#shopable").css("display", "none")
	} else {
		$("#balance").text(peple.balance)
	}
	if(points.length < 2) { //判断用户是否活跃(用户积分的次数大于等于2)
		$("#actively").css("display", "none")
	}
	var securityScore = 0;
	if(peple.mobile != null) {
		securityScore += 20
	}
	if(peple.email != null) {
		securityScore += 10
	}
	if(peple.id_card != null) {
		securityScore += 10
	}
	$("#securityScore").text(securityScore)
	//求用户的积分
	var sumPoints = 0;
	$.each(points, function(index,value) {
		if(value.gain == "是") {
			sumPoints += value.point;
		} else {
			sumPoints -= value.point;
		}
	});
	$("#points").text(sumPoints);
	/*用户订单添加*/
	$.get("/api/order/list", function(data) {
		var order = data.data.data
		$("#orderList").empty();
		order.forEach(function(value, index) {
			var goodsCounts = value.goodsCount;
			goodsPrice = value.goods_price;
			orderTime = value.add_time.trim();
			orderStatus = value.order_status_text;
			var orderDate = orderTime.substr(0, 10)
			var orderHours = orderTime.substr(11)
			var orderHtml = "<div class='orderContentBox'>" +
				"<div class='orderContent'>" +
				"<div class='orderContentpic'>" +
				"<div class='imgBox'>" +
				"<a href='orderinfo.html'><img src='../images/youzi.jpg'></a>" +
				"</div>" +
				"</div>" +
				"<div class='detailContent'>" +
				"<a href='orderinfo.html' class='delivery'>签收</a>" +
				"<div class='orderID'>" +
				"<span class='time'>" + orderDate + "</span>" +
				"<span class='splitBorder'>|</span>" +
				"<span class='time'>" + orderHours + "</span>" +
				"</div>" +
				"<div class='orderID'>" +
				"<span class='num'>共" + goodsCounts + "件商品</span>" +
				"</div>" +
				"</div>" +
				"<div class='state'>" + orderStatus + "</div>" +
				"<div class='price'><span class='sym'>¥</span><span class='sym'>" + goodsPrice + "</span></div>" +
				"</div>" +
				"<a href='' class='btnPay'>订单详情</a>" +
				"</div>";
			$("#orderList").append(orderHtml)
		})

	})
	//添加商品收藏
	$.get("/api/collect/list", function(data) {
		var collectList = data.data;
		$("#shopCollection").empty()
		collectList.forEach(function(value, index) {
			var shopImg = value.list_pic_url;
			shopPrice = value.retail_price;
			shopId = value.value_id;
			html = "<li id='shopId'>" +
				"<a><img class='am-thumbnail' src='" + shopImg + "' /></a>" +
				"<strong class='price'>¥" + shopPrice + "</strong>" +
				"</li>";
			$("#shopCollection").append(html)
		})
	})
	//添加购物足迹
	$.get("/api/footprint/list", function(data) {
		var footPrint = data.data;
		if($.isEmptyObject(footPrint)){return;}
		$("#footPrint").empty();
		footPrint.forEach(function(value, index) {
			var shopImg = value.list_pic_url;
			shopPrice = value.retail_price;
			shopId = value.value_id;
			html = "<li id='shopId'>" +
				"<a><img class='am-thumbnail' src='" + shopImg + "' /></a>" +
				"<strong class='price'>¥" + shopPrice + "</strong>" +
				"</li>";
			$("#footPrint").append(html)
		});
	});
</script>